import anyio

async def sender(send_stream):
    async with send_stream:
        for i in range(5):
            await send_stream.send(i)
            print(f"Sent: {i}")
            await anyio.sleep(1)

async def receiver(receive_stream):
    async with receive_stream:
        async for item in receive_stream:
            print(f"Received: {item}")

async def main_run():
    send_stream, receive_stream = anyio.create_memory_object_stream()
    async with anyio.create_task_group() as tg:
        tg.start_soon(sender, send_stream)
        tg.start_soon(receiver, receive_stream)

anyio.run(main_run)